<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>左移和右移</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .box{
            width: 500px;
            height: 300px;
            margin: 10px auto;
        }
        #left{
            float: left;
            margin-left: 50px;
        }
        #opt{
            float: left;
            margin-left: 50px;
            margin-top: 20px;
        }
        #right{
            float: left;
            margin-left: 50px;
        }
        #toRight{
            width: 40px;
            height: 40px;
        }
        #toLeft{
            width: 40px;
            height: 40px;
        }
        #toAllRight{
            width: 40px;
            height: 40px;
        }
        #toAllLeft{
            width: 40px;
            height: 40px;
        }
    </style>
</head>
<body>
    <script src="./jquery-3.2.1.min.js"></script>
    <div class="box">
        <div id="left">
            <p>可选项</p>
            <select multiple="multiple" style="height:200px;width:100px;">
                <option>添加</option>
                <option>移动</option>
                <option>修改</option>
                <option>查询</option>
                <option>打印</option>
                <option>删除</option>
            </select>
        </div>
        <div id="opt">
            <input id="toRight" type="button" value=">"><br>
            <input id="toLeft" type="button" value="<"><br>
            <input id="toAllRight" type="button" value=">>"><br>
            <input id="toAllLeft" type="button" value="<<"><br>
        </div>
        <div id="right">
            <p>已选项</p>
            <select multiple="multiple" style="height: 200px;width: 100px;"></select>
        </div>
    </div>
    <script>
        $('#toRight').click(function() {       
            $('#right>select').append($('#left>select>option:selected'));
    	});
    	$('#toLeft').click(function() {        
    	    $('#left>select').append($('#right>select>option:selected'));
    	});
    	$('#toAllRight').click(function() {    
    	    $('#right>select').append($('#left>select>option'));
    	});
    	$('#toAllLeft').click(function() { 
    	    $('#left>select').append($('#right>select>option'));
    	});
    </script>
   
</body>
</html>